
public class HandshakeMessage extends Message{
	//Members	
	HandShakeFormat hf = new HandShakeFormat();
	private byte[] payload = new byte[32];
	
	HandshakeMessage(Integer peerID){
		
		hf.peerID = peerID.toString().getBytes();
		int count = 0;
		for (byte ele : hf.header) {
			payload[count++] = ele;
		}
		for (byte ele : hf.zeroBits) {
			payload[count++] = ele;
		}
		for (byte ele : hf.peerID) {
			payload[count++] = ele;
		}
		setType(MessageType.HANDSHAKE.getValue());		
		setPayload(payload);
		setLength(33);
	}
	
	@Override
	public Byte getType() {
		// TODO Auto-generated method stub
		return type;
	}

	@Override
	protected void setType(Byte type) {
		// TODO Auto-generated method stub
		this.type = type;
		
	}

	@Override
	public int getLength() {
		// TODO Auto-generated method stub
		return length;
	}

	@Override
	protected void setLength(int length) {
		// TODO Auto-generated method stub
		this.length = length;
	}

	@Override
	public byte[] getPayload() {
		// TODO Auto-generated method stub
		return payload;
	}

	@Override
	public void setPayload(byte[] payload) {
		// TODO Auto-generated method stub
		this.payload = payload;
	}

}

class HandShakeFormat{
	byte[] header = new byte[18];
	byte[] zeroBits = new byte[]{0,0,0,0,0,0,0,0,0,0};
	byte[] peerID = new byte[4];
	HandShakeFormat(){
		header = new String("CEN5501C2008SPRING").getBytes();
	}
}
